/**
 * @constructor
 * @param {Element} container
 * @returns {OnPageLogger}
 */
function OnPageLogger(container) {
	this.container = container;
};

/**
 * @public
 * @param {Object} exception
 */
OnPageLogger.prototype.log = function(exception) {
	$("<span>" + exception.constructor.name + ": <br>" + exception.message + "<br><br></span>").appendTo(this.container);
};

if (Function.prototype.name === undefined && Object.defineProperty !== undefined) {
    Object.defineProperty(Function.prototype, 'name', {
        get: function() {
            var funcNameRegex = /function\s([^(]{1,})\(/;
            var results = (funcNameRegex).exec((this).toString());
            return (results && results.length > 1) ? results[1].trim() : "";
        },
        set: function(value) {}
    });
}